<template>
    <div>
        <h1>{{ msg }}</h1>
        <el-button type="primary" @click="onSubmit()">查询</el-button>
    </div>
</template>
<script>
// import { getUserList, getInfo} from '@/api/business'
import axios from 'axios'
import request from '@/utils/request'
export default {
    name: 'Request',
    data () {
        return {
            key: 'value',
            msg: 'this is a request'
        }
    },
    mounted () {
        console.log("mounted");
    },
    methods: {
        onSubmit () {
            let that = this;
            let header = {
                'target': 'bbbb',
                'Content-Type': 'application/json',
                'ccc': 'ddddddddd'
            };
            let param = {
                'key': 'value'
            }
            let data = {
                "head": {
                    "key1": "value1",
                    "key2": "value2"
                },
                "body": {
                    "key3": "value3",
                    "head": {
                        "key4": "value4"
                    }
                }
            }
            let options = {
                url: "http://localhost:3000/ssm/status",
                method: 'post',
                headers: header,
                params: param,
                data: JSON.stringify(data)
            }
            request(options).then(response => {
                that.submitCallback(response.data);
            }).catch(err => {
                console.log(err);
            })
        },
        submitCallback (response) {
            console.log("response");
            console.log(response);
        }
    }
}
</script>
<style scoped>
::v-deep .el-button {
    width: 80px;
    height: 26px;
    background-color: #008be3;
    color: #fff;
    border: 1px solid #008be3;
    border-radius: 0;
    font-size: 14px;
    padding: 0;
  }
</style>